import os

from tif_stats import analyze_tif_files, wp_cost_type_mapping, tco2_cost_type_mapping, ett_cost_type_mapping, \
    ap_cost_type_mapping
from tif_stats.sum.ap_wp_excel_sum import process_excel_file, columns_to_sum, columns_to_keep


if __name__ == "__main__":
    tif_folder_path = r'I:\GEP_result\2023\Qap'
    analyze_tif_files(tif_folder_path, cost_type_mapping = ap_cost_type_mapping, excel_path = r'H:\GEP_excel_data\V_price\价格表-总表.xlsx')

    folder_name = os.path.basename(tif_folder_path)
    parent_folder_path = os.path.dirname(tif_folder_path)  # 获取上级文件夹路径
    excel_output_path = os.path.join(parent_folder_path, rf'{folder_name}_results.xlsx')

    rows_to_replace = ['QapNOx', 'QapPM', 'QapSO2']
    print(f'output_path: {excel_output_path}')
    process_excel_file(excel_output_path, columns_to_sum, columns_to_keep, rows_to_replace)



    tif_folder_path = r'I:\GEP_result\2023\Qwp'
    analyze_tif_files(tif_folder_path, cost_type_mapping = wp_cost_type_mapping, excel_path = r'H:\GEP_excel_data\V_price\价格表-总表.xlsx')

    folder_name = os.path.basename(tif_folder_path)
    parent_folder_path = os.path.dirname(tif_folder_path)  # 获取上级文件夹路径
    excel_output_path = os.path.join(parent_folder_path, rf'{folder_name}_results.xlsx')

    rows_to_replace = ['QwpCOD', 'QwpTN', 'QwpTP']
    print(f'output_path: {excel_output_path}')
    process_excel_file(excel_output_path, columns_to_sum, columns_to_keep, rows_to_replace)



    tif_folder_path = r'I:\GEP_result\2023\test_Qtco2'
    analyze_tif_files(tif_folder_path, cost_type_mapping = tco2_cost_type_mapping, excel_path = r'H:\GEP_excel_data\V_price\价格表-总表.xlsx')


    ett_tif_folder_path = r'I:\GEP_result\2023\Qett_v1'
    analyze_tif_files(ett_tif_folder_path, cost_type_mapping = ett_cost_type_mapping, excel_path = r'H:\GEP_excel_data\V_price\价格表-总表.xlsx')



